package com.apes.fn.crm.customerExpand;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * Creator: zouyc
 * CreateDate: 2020-09-15 10:01
 * Description:
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = PickUpTypeF.CONST_TABLE_NAME)
public class PickUpTypeF extends BaseModel {
    public static final String CONST_TABLE_NAME = "fn_pick_up_type_f";

    @Id
    @Column(name = "id", nullable = false, length = 24)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "接车类型", padding = 10)
    private String id;

    @ManyToOne(optional = false)
    @JoinColumn(name = "fn_customer_expand_id", referencedColumnName = "id", nullable = false)
    @Comment("接车单号")
    private FnCustomerExpand fnCustomerExpand;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "type", referencedColumnName = "id")
    @Comment("接车类型")
    private Enumeration pickUpType;

    @Column(name = "remarks", length = 520)
    @Comment("其他说明")
    private String remarks;
}